<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;
use app\middleware\BackendLoginCheck;

/**
 * 小程序接口
 */
Route::group(function() {
    //用户登录、注册
    Route::post('api/regLogin', 'user/regLogin');
    //检测用户绑定手机号
    Route::get('api/ckp', 'user/checkBind');
    //商品分类
    Route::get('api/category', 'goods/category');
    //选品库商品列表
    Route::get('api/goods', 'goods/index');
    //小程序轮播图
    Route::get('api/ads', 'goods/ad');
    //商品详情
    Route::get('api/detail', 'goods/detail');
    //商品主播直播
    Route::get('api/live', 'goods/getProductInfo');

    //抖音回调地址
    Route::get('api/dy_auth_callback','DyAuth/dyAuthCallback');

    Route::get('api/get_user_item','DyAuth/getUserItem');

    //需要登录认证的接口
    Route::group(function(){
        //我的选品库
        Route::get('api/my_choose', 'goods/choose_goods');
        //添加到我的选品库
        Route::get('api/add_choose', 'goods/add_choose');
        //删除我的选品库中商品
        Route::get('api/del_choose', 'goods/del_choose');
        //收藏商品
        Route::get('api/add_col', 'goods/add_collection');
        //删除收藏商品
        Route::get('api/del_col', 'goods/del_collection');
        //收藏列表
        Route::get('api/collection', 'goods/collection');
        //商家中心
        Route::get('api/shop', 'shop/detail');

        /*申请领样*/
        Route::post('api/apply_sample','Sample/applySample');
        //领样列表
        Route::get('api/apply_sample_list','Sample/applySampleList');
        //取消领样
        Route::post('api/cancel/sample','Sample/cancelSample');
        //领样详情
        Route::get('api/sample_detail','Sample/sampleDetail');

        //抖音带货地址 新增或修改
        Route::post('api/dy_user_address','DyAuth/DyUserAddress');
        //抖音带货地址列表
        Route::get('api/dy_user_address','DyAuth/DyUserAddressList');
        Route::get('api/dtl/dy_user_address','DyAuth/DyUserAddressDetail');
        //删除
        Route::post('api/del/dy_user_address','DyAuth/DyUserAddressDel');
        //修改绑定手机号
        Route::post('api/cgp','user/cgp');
        //抖音授权码
        Route::get('api/dy_auth_code','DyAuth/dyAuthCode');
        //创作服务平台二维码
        Route::get('api/creator_code','DyAuth/creatorCode');
        //检测token状态
        Route::post('api/check_qr_status','DyAuth/checkQrStatus');
        //获取抖音用户信息
        Route::post('api/dy_user_info','DyAuth/dyUserInfo');
        //抖音账号管理
        Route::get('api/dy_user_list','DyAuth/dyUserList');
        //抖音详情
        Route::get('api/dy_user_detail','DyAuth/dyUserDetail');
        //删除抖音账号
        Route::post('api/del_dy_user','DyAuth/delDyUser');
        //绑定商务达人
        Route::post('api/sw_daren/bind','SwDaren/swDarenBind');
    })->middleware(\app\middleware\ApiCheck::class);
    //快递公司
    Route::get('api/express_company','Sample/expressCompany');
    //商务接口
    Route::group(function(){
        //发样列表
        Route::get('api/send_sample_list','Sample/sendSampleList');
        //填写快递单号
        Route::post('api/express_no/write','Sample/expressNoWrite');

        //领样详情
        Route::get('api/sw_sample_detail','Sample/swSampleDetail');
        //达人广场
        Route::get('api/dr_list','SwDaren/index');
        //达人信息
        Route::get('api/dr_info','SwDaren/drInfo');
        //达人跟进
        Route::post('api/dr_track','SwDaren/drTrack');
        //达人跟进记录
        Route::get('api/track_record','SwDaren/trackRecord');
        //商务自行发样
        Route::post('api/own_send_sample','SwDaren/ownSendSample');
        //设置达人手机号
        Route::post('api/wise_man_phone/set','SwDaren/setWiseManPhone');
        //达人商品
        Route::get('api/wiseman/goods','goods/getWismanGoods');
    })->middleware(\app\middleware\SwLoginCheck::class);

});


//后台注册、登录
Route::group(function() {
    //发送短信
    Route::post('api/sms', 'Sms/smsSend');
    //短信验证码验证
    Route::post('api/sms_verify', 'Sms/smsVerify');
    //注册
    Route::post('api/reg', 'AdminAuth/register');
    //登录
    Route::post('api/login', 'AdminAuth/login');
    //退出登录
    Route::post('api/logout', 'AdminAuth/logout');
    //
    Route::post('api/pwd_forget','AdminAuth/pwdForget');

    Route::get('api/plugin','Download/down');
});

//后台接口
Route::group(function() {
    Route::post('api/file_upload','FileUpload/create');

    /*公司管理*/
    Route::post('api/company/store', 'AdminCompany/store');
    Route::get('api/company/list', 'AdminCompany/list');

    /*用户管理*/
    Route::get('api/user_info','AdminUser/getUserInfo');
    Route::post('api/user/store', 'AdminUser/store');
    Route::get('api/user_list', 'AdminUser/userList');
    Route::post('api/user/status_operation','AdminUser/statusOperation');

    /*小组管理*/
    Route::get('api/team/list', 'AdminTeam/teamList');

    /*角色管理*/
    Route::post('api/role/store','AdminRole/store');
    Route::get('api/role/list', 'AdminRole/list');

    //所有的商品列表
    Route::get('api/goods_list','AdminGoods/goodsList');
    //活动管理
    Route::get('api/shop/tell','AdminActivity/shopTell');
    /*创建活动*/
    Route::post('api/activity/save','AdminActivity/save');
    /*活动操作 上、下线 删除*/
    Route::post('api/activity/operation','AdminActivity/activityOperation');
    /*活动列表*/
    Route::get('api/activity_list', 'AdminActivity/myActivityList');
    /*活动商品审核*/
    Route::post('api/activity/audit/operation','AdminActivity/activityAuditOperation');
    //活动详情
    Route::get('api/activity/detail','AdminActivity/activityDetail');
    //活动商品列表
    Route::get('api/activity/goods_list', 'AdminActivity/activityGoodsList');

    //活动推广效果
    Route::get('api/promotion_effect','AdminActivity/promotionEffect');

    //商品列表导出
    Route::get('api/goods_export','AdminActivity/goodsExport');
    //设置小程序显示
    Route::post('api/goods/show_hide','AdminGoods/setGoodsShowHide');
    Route::post('api/goods/multi_show_hide','AdminGoods/setMultiGoodsShowHide');

    //刷新报名商品
    Route::post('api/refresh_apply_goods','AdminActivity/refreshApplyGoods');
    //刷新推广效果
    Route::post('api/refresh_promotion_effect','AdminActivity/refreshPromotionEffect');
    //刷新服务费明细
    Route::post('api/refresh_service_list','AdminActivity/refreshServiceFeeList');

    //轮播图
    Route::get('api/carouse_list','AdminCarouse/index');
    //显示隐藏
    Route::post('api/carouse/status_operation','AdminCarouse/statusOperation');
    Route::post('api/carouse/save','AdminCarouse/save');
    Route::post('api/del_carouse','AdminCarouse/delete');

})->middleware(BackendLoginCheck::class);

//实时巨量百应接口
Route::group(function() {
    Route::post('api/goods/apply_records','ZsApi/GoodsApplyRecord');
    Route::get('api/index', 'index/index');
    //实时活动
    Route::get('api/real_time/activity','AdminActivity/realTimeActivityList');
    //获取活动列表
    Route::get('api/real_time/activity_goods','AdminActivity/realTimeActivityGoodsList');
    /*活动推广效果*/
    Route::get('api/real_time/promotion_effect','AdminActivity/realTimePromotionEffect');
    //服务费明细
    Route::get('api/real_time/service_fee','AdminActivity/realTimeServiceFeeList');
});

// test
Route::group(function() {
    Route::get('api/user', 'Sample/userList');
    Route::get('api/test', 'Test/index');
    Route::post('api/template_msg','Test/sendTemplate');

    Route::get('api/request', 'Test/request');
    Route::post('api/cookie_to_array', 'Test/cookieToArray');

});



